const waitTime = (time = 100) => {
  return new Promise(resolve => {
    setTimeout(() => {
      resolve(true);
    }, time);
  });
};

export default {
  'POST /api/user/login': async (req, res) => {
    await waitTime(2000);
    res.send({
      code: 200,
      msg: 'ok',
      data: {
        userId: '2222222',
        token: '12345678901234567890',
      },
    });
  },

  'POST /api/user/getUserInfo': async (req, res) => {
    await waitTime(300);
    res.send({
      code: 200,
      msg: 'ok',
      data: {
        userId: '2222222',
        name: '本初',
        avatar:
          'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
        email: 'antdesign@alipay.com',
        signature: '海纳百川，有容乃大',
      },
    });
  },

  'POST /api/user/clearLogin': async (req, res) => {
    await waitTime(200);
    res.send({
      code: 200,
      msg: 'ok',
      data: {},
    });
  },

  'GET /api/test': async (req, res) => {
    res.send({
      code: 200,
      message: '',
      result: {
        bayList: [18, 2, 22, 6, 26, 10, 14, 30],
        callType: 1,
        craneWorkList: [
          {
            craneId: 'CR46',
            workQueueList: [
              {
                bAppendWorkQueue: true,
                bImportBay: false,
                bayId: '03',
                endWorkTime: '2021-09-27 15:17:00',
                startWorkTime: '2021-09-27 14:30:00',
                totalWiCount: 19,
                workInstructionCount: 19,
                workQueueName: 'NOSRC44.Disch.03B.20s',
              },
              {
                bAppendWorkQueue: true,
                bImportBay: false,
                bayId: '01',
                endWorkTime: '2021-09-27 16:01:00',
                startWorkTime: '2021-09-27 15:17:00',
                totalWiCount: 21,
                workInstructionCount: 18,
                workQueueName: 'NOSRC44.Disch.01B.20s',
              },
              {
                bAppendWorkQueue: true,
                bImportBay: false,
                bayId: '01',
                endWorkTime: '2021-09-27 16:04:00',
                startWorkTime: '2021-09-27 16:01:00',
                totalWiCount: 21,
                workInstructionCount: 1,
                workQueueName: 'NOSRC44.Load.01B.20s',
              },
              {
                bAppendWorkQueue: true,
                bImportBay: false,
                bayId: '01',
                endWorkTime: '2021-09-27 16:07:00',
                startWorkTime: '2021-09-27 16:03:00',
                totalWiCount: 21,
                workInstructionCount: 2,
                workQueueName: 'NOSRC44.Load.01B.20s',
              },
            ],
          },
          {
            craneId: 'CR45',
            workQueueList: [
              {
                bAppendWorkQueue: true,
                bImportBay: true,
                bayId: '14',
                endWorkTime: '2021-09-27 14:35:00',
                startWorkTime: '2021-09-27 14:30:00',
                totalWiCount: 27,
                workInstructionCount: 2,
                workQueueName: 'NOSRC44.Disch.14B.40s',
              },
              {
                bAppendWorkQueue: true,
                bImportBay: true,
                bayId: '13',
                endWorkTime: '2021-09-27 15:36:00',
                startWorkTime: '2021-09-27 14:35:00',
                totalWiCount: 25,
                workInstructionCount: 25,
                workQueueName: 'NOSRC44.Disch.13B.20s',
              },
              {
                bAppendWorkQueue: false,
                bImportBay: true,
                bayId: '18',
                endWorkTime: '2021-09-27 15:41:00',
                startWorkTime: '2021-09-27 15:36:00',
                totalWiCount: 23,
                workInstructionCount: 2,
                workQueueName: 'NOSRC44.Disch.18B.40s',
              },
              {
                bAppendWorkQueue: false,
                bImportBay: true,
                bayId: '18',
                endWorkTime: '2021-09-27 16:41:00',
                startWorkTime: '2021-09-27 15:41:00',
                totalWiCount: 23,
                workInstructionCount: 21,
                workQueueName: 'NOSRC44.Load.18B.40s',
              },
              {
                bAppendWorkQueue: false,
                bImportBay: true,
                bayId: '10',
                endWorkTime: '2021-09-27 16:53:00',
                startWorkTime: '2021-09-27 16:41:00',
                totalWiCount: 45,
                workInstructionCount: 5,
                workQueueName: 'NOSRC44.Disch.10B.40s',
              },
              {
                bAppendWorkQueue: false,
                bImportBay: true,
                bayId: '11',
                endWorkTime: '2021-09-27 17:32:00',
                startWorkTime: '2021-09-27 16:53:00',
                totalWiCount: 16,
                workInstructionCount: 16,
                workQueueName: 'NOSRC44.Disch.11B.20s',
              },
              {
                bAppendWorkQueue: false,
                bImportBay: true,
                bayId: '10',
                endWorkTime: '2021-09-27 18:41:00',
                startWorkTime: '2021-09-27 17:32:00',
                totalWiCount: 45,
                workInstructionCount: 24,
                workQueueName: 'NOSRC44.Load.10B.40s',
              },
            ],
          },
        ],
        vesselReference: 'NOSRC44',
        vesselSide: 0,
      },
    });
  },
};
